package org.zxw.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.zxw.pojo.entity.TrainingPlan;

import java.util.List;

@Mapper
public interface TrainingPlanMapper {
    // 根据目标查询计划
    @Select("SELECT * FROM training_plan WHERE goal = #{goal} ORDER BY RAND() LIMIT #{limit}")
    List<TrainingPlan> selectByGoal(@Param("goal") String goal, @Param("limit") int limit);
    
    // 根据目标和难度查询计划
    @Select("SELECT * FROM training_plan WHERE goal = #{goal} AND difficulty = #{difficulty} ORDER BY RAND() LIMIT #{limit}")
    List<TrainingPlan> selectByGoalAndDifficulty(
        @Param("goal") String goal, 
        @Param("difficulty") String difficulty,
        @Param("limit") int limit);
    
    // 根据BMI推荐计划 (BMI < 18.5:增肌; 18.5-24:塑形; >24:减脂)
    List<TrainingPlan> selectByBmi(
        @Param("bmi") double bmi, 
        @Param("difficulty") String difficulty,
        @Param("limit") int limit);
}